<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>MecGridSorting.mxml</title>
<link rel="stylesheet" type="text/css" href="../../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span>
<span class="MXMLComponent_Tag">&lt;mx:Canvas</span><span class="MXMLDefault_Text"> xmlns:mx=&quot;</span><span class="MXMLString">http://www.adobe.com/2006/mxml</span><span class="MXMLDefault_Text">&quot; width=&quot;</span><span class="MXMLString">400</span><span class="MXMLDefault_Text">&quot; height=&quot;</span><span class="MXMLString">300</span><span class="MXMLDefault_Text">&quot; xmlns:ns1=&quot;</span><span class="MXMLString">com.mechan.MecGrid.*</span><span class="MXMLDefault_Text">&quot; creationComplete=&quot;</span><span class="ActionScriptDefault_Text">initApp</span><span class="ActionScriptBracket/Brace">()</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
<span class="MXMLSpecial_Tag">&lt;mx:Script&gt;</span>
    <span class="ActionScriptOperator">&lt;!</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">CDATA</span><span class="ActionScriptBracket/Brace">[</span>
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">mechan</span>.<span class="ActionScriptDefault_Text">MecGrid</span>.<span class="ActionScriptDefault_Text">mecGridClasses</span>.<span class="ActionScriptDefault_Text">SelectedItem</span>; 
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">controls</span>.<span class="ActionScriptDefault_Text">Alert</span>;
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">mechan</span>.<span class="ActionScriptDefault_Text">MecGrid</span>.<span class="ActionScriptDefault_Text">mecGridClasses</span>.<span class="ActionScriptDefault_Text">MecGridEvent</span>;
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">mechan</span>.<span class="ActionScriptDefault_Text">MecGrid</span>.<span class="ActionScriptDefault_Text">mecGridClasses</span>.<span class="ActionScriptDefault_Text">CellOp</span>;
        <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span>.<span class="ActionScriptDefault_Text">mechan</span>.<span class="ActionScriptDefault_Text">MecGrid</span>.<span class="ActionScriptDefault_Text">mecGridClasses</span>.<span class="ActionScriptDefault_Text">MecGridConst</span>;
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">initApp</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
        <span class="ActionScriptBracket/Brace">}</span> 

<span class="ActionScriptComment">// POPULATE SAMPLE DATA (LIST)
</span>        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">populateGridData</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">merge_option</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">MecGridConst</span>.<span class="ActionScriptDefault_Text">MERGE_FIXED</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">defaultwidth</span> <span class="ActionScriptOperator">=</span> 80;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">defaultheight</span> <span class="ActionScriptOperator">=</span> 18;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">editable</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">redraw</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
            
            <span class="ActionScriptComment">// clear all resources
</span>            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">count</span> <span class="ActionScriptOperator">=</span> 0;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">count</span> <span class="ActionScriptOperator">=</span> 0;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">spreadSheetStyle</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">count</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">nrow</span>.<span class="ActionScriptDefault_Text">value</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">count</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">ncolumn</span>.<span class="ActionScriptDefault_Text">value</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">fixed</span> <span class="ActionScriptOperator">=</span> 2;
            
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span>;
            <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">int</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">AddColumn</span><span class="ActionScriptBracket/Brace">(</span>0<span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">AddRow</span><span class="ActionScriptBracket/Brace">(</span>0, <span class="ActionScriptString">&quot;No.;Browser;Visits;Visits;Visits;Visits;Bounce Rates;Pageviews;Pageviews;PageViews&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">AddRow</span><span class="ActionScriptBracket/Brace">(</span>1, <span class="ActionScriptString">&quot;No.;Browser;Visits;%visits;New Visitors;Unique Visitors;Bounce Rates;Pageviews;Average;Time on site&quot;</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">fixed</span>; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">count</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">=</span>0; <span class="ActionScriptDefault_Text">j</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">count</span>; <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptReserved">if</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">j</span> <span class="ActionScriptOperator">==</span> 0<span class="ActionScriptBracket/Brace">)</span>
                    <span class="ActionScriptBracket/Brace">{</span>
                        <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">set_cell</span><span class="ActionScriptBracket/Brace">(C</span><span class="ActionScriptDefault_Text">ellOp</span>.<span class="ActionScriptDefault_Text">TEXT</span>, <span class="ActionScriptDefault_Text">i</span>, <span class="ActionScriptDefault_Text">j</span>, <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                    <span class="ActionScriptReserved">else</span>
                    <span class="ActionScriptBracket/Brace">{</span>
                        <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">set_cell</span><span class="ActionScriptBracket/Brace">(C</span><span class="ActionScriptDefault_Text">ellOp</span>.<span class="ActionScriptDefault_Text">TEXT</span>, <span class="ActionScriptDefault_Text">i</span>, <span class="ActionScriptDefault_Text">j</span>, <span class="ActionScriptString">&quot;r&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptString">&quot;,c&quot;</span> <span class="ActionScriptOperator">+</span> <span class="ActionScriptDefault_Text">j</span><span class="ActionScriptBracket/Brace">)</span>;
                    <span class="ActionScriptBracket/Brace">}</span>
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">set_cell</span><span class="ActionScriptBracket/Brace">(C</span><span class="ActionScriptDefault_Text">ellOp</span>.<span class="ActionScriptDefault_Text">TEXTALIGN</span>, 0, 7, <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">TEXTALIGN_LEFT_TOP</span><span class="ActionScriptBracket/Brace">)</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>3<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">autowidth</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>3<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">width</span> <span class="ActionScriptOperator">=</span> 100;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>3<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">datatype</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">STATUSBAR</span>;
            
            <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">fixed</span>; <span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptOperator">&lt;</span> <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Rows</span>.<span class="ActionScriptDefault_Text">count</span>; <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">++</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">set_cell</span><span class="ActionScriptBracket/Brace">(C</span><span class="ActionScriptDefault_Text">ellOp</span>.<span class="ActionScriptDefault_Text">TEXT</span>, <span class="ActionScriptDefault_Text">i</span>, 3, <span class="ActionScriptDefault_Text">Math</span>.<span class="ActionScriptDefault_Text">random</span><span class="ActionScriptBracket/Brace">()</span> <span class="ActionScriptOperator">*</span> 100<span class="ActionScriptBracket/Brace">)</span>;
            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>4<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">autowidth</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>4<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">textalign</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">TEXTALIGN_CENTER_CENTER</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>4<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">datatype</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">TEXT</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>5<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">editable</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>6<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">editable</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>7<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">editable</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>8<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">editable</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">false</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>7<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">datatype</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">BOOLEAN</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>7<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">textalign</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">TEXTALIGN_CENTER_CENTER</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>8<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">datatype</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">TEXT</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">Cols</span>.<span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">(</span>8<span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">textalign</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">TEXTALIGN_LEFT_CENTER</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">SelectionMode</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">SELECTIONMODE_ROW</span>;
            
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">redraw</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
        <span class="ActionScriptBracket/Brace">}</span>

<span class="ActionScriptComment">// USER ACTION
</span>        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">changeSelectionMode</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">switch</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">mgridSelectionMode</span>.<span class="ActionScriptDefault_Text">selectedValue</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;Row&quot;</span><span class="ActionScriptOperator">:</span>
                <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">SelectionMode</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">SELECTIONMODE_ROW</span> <span class="ActionScriptOperator">|</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">SELECT_SINGLE</span>;
                <span class="ActionScriptReserved">break</span>;
            <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;Column&quot;</span><span class="ActionScriptOperator">:</span>
                <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">SelectionMode</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">SELECTIONMODE_CELL</span> <span class="ActionScriptOperator">|</span> <span class="ActionScriptDefault_Text">CellOp</span>.<span class="ActionScriptDefault_Text">SELECT_MULTI</span>;
                <span class="ActionScriptReserved">break</span>;
            <span class="ActionScriptBracket/Brace">}</span> 
        <span class="ActionScriptBracket/Brace">}</span>
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">changeSortMode</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">switch</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">mgridSortMode</span>.<span class="ActionScriptDefault_Text">selectedValue</span><span class="ActionScriptBracket/Brace">)</span>
            <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;SORT_NONE&quot;</span><span class="ActionScriptOperator">:</span>
                <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">SortOption</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">MecGridConst</span>.<span class="ActionScriptDefault_Text">SORT_NONE</span>;
                <span class="ActionScriptReserved">break</span>;
            <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;SORT_SINGLE&quot;</span><span class="ActionScriptOperator">:</span>
                <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">SortOption</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">MecGridConst</span>.<span class="ActionScriptDefault_Text">SORT_SINGLE_COLUMN</span>;
                <span class="ActionScriptReserved">break</span>;
            <span class="ActionScriptReserved">case</span> <span class="ActionScriptString">&quot;SORT_MULTI&quot;</span><span class="ActionScriptOperator">:</span>
                <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">SortOption</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">MecGridConst</span>.<span class="ActionScriptDefault_Text">SORT_MULTI_COLUMN</span>;
                <span class="ActionScriptReserved">break</span>;
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">}</span>
        
        
        <span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">changeSpreadSheetStyle</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
        <span class="ActionScriptBracket/Brace">{</span>
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">spreadSheetStyle</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptDefault_Text">btnSpreadSheetStyle</span>.<span class="ActionScriptDefault_Text">selected</span>;
            <span class="ActionScriptDefault_Text">mgrid</span>.<span class="ActionScriptDefault_Text">redraw</span> <span class="ActionScriptOperator">=</span> <span class="ActionScriptReserved">true</span>;
        <span class="ActionScriptBracket/Brace">}</span>
    <span class="ActionScriptBracket/Brace">]]</span><span class="ActionScriptOperator">&gt;</span>
<span class="MXMLSpecial_Tag">&lt;/mx:Script&gt;</span> 
    <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> x=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; y=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; text=&quot;</span><span class="MXMLString">MULTI SORTING</span><span class="MXMLDefault_Text">&quot; styleName=&quot;</span><span class="MXMLString">demoTitle</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;mx:VBox</span><span class="MXMLDefault_Text"> left=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; right=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; top=&quot;</span><span class="MXMLString">40</span><span class="MXMLDefault_Text">&quot; bottom=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
        <span class="MXMLComponent_Tag">&lt;mx:HBox</span><span class="MXMLDefault_Text"> width=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> text=&quot;</span><span class="MXMLString">Rows</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:NumericStepper</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">nrow</span><span class="MXMLDefault_Text">&quot; minimum=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; maximum=&quot;</span><span class="MXMLString">1000000</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">40</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> text=&quot;</span><span class="MXMLString">Columns</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:NumericStepper</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">ncolumn</span><span class="MXMLDefault_Text">&quot; minimum=&quot;</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">&quot; maximum=&quot;</span><span class="MXMLString">1000000</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">20</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:Button</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">Populate Data</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">populateGridData</span><span class="ActionScriptBracket/Brace">()</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/mx:HBox&gt;</span>
        <span class="MXMLComponent_Tag">&lt;mx:HBox</span><span class="MXMLDefault_Text"> width=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RadioButtonGroup</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">mgridSelectionMode</span><span class="MXMLDefault_Text">&quot; change=&quot;</span><span class="ActionScriptDefault_Text">changeSelectionMode</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RadioButton</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">SelectRow</span><span class="MXMLDefault_Text">&quot; groupName=&quot;</span><span class="MXMLString">mgridSelectionMode</span><span class="MXMLDefault_Text">&quot; selected=&quot;</span><span class="MXMLString">true</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">Row</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RadioButton</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">SelectCell</span><span class="MXMLDefault_Text">&quot; groupName=&quot;</span><span class="MXMLString">mgridSelectionMode</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">Column</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:CheckBox</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">btnSpreadSheetStyle</span><span class="MXMLDefault_Text">&quot; label=&quot;</span><span class="MXMLString">SpreadSheetStyle</span><span class="MXMLDefault_Text">&quot; click=&quot;</span><span class="ActionScriptDefault_Text">changeSpreadSheetStyle</span><span class="ActionScriptBracket/Brace">()</span><span class="MXMLDefault_Text">&quot; selected=&quot;</span><span class="MXMLString">true</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:Label</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">labelVisibleArea</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/mx:HBox&gt;</span>
        <span class="MXMLComponent_Tag">&lt;mx:HBox</span><span class="MXMLDefault_Text"> width=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RadioButtonGroup</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">mgridSortMode</span><span class="MXMLDefault_Text">&quot; change=&quot;</span><span class="ActionScriptDefault_Text">changeSortMode</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RadioButton</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">SORT_NONE</span><span class="MXMLDefault_Text">&quot; groupName=&quot;</span><span class="MXMLString">mgridSortMode</span><span class="MXMLDefault_Text">&quot; selected=&quot;</span><span class="MXMLString">true</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">SORT_NONE</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RadioButton</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">SORT_SINGLE</span><span class="MXMLDefault_Text">&quot; groupName=&quot;</span><span class="MXMLString">mgridSortMode</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">SORT_SINGLE</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
            <span class="MXMLComponent_Tag">&lt;mx:RadioButton</span><span class="MXMLDefault_Text"> label=&quot;</span><span class="MXMLString">SORT_MULTI</span><span class="MXMLDefault_Text">&quot; groupName=&quot;</span><span class="MXMLString">mgridSortMode</span><span class="MXMLDefault_Text">&quot; value=&quot;</span><span class="MXMLString">SORT_MULTI</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
        <span class="MXMLComponent_Tag">&lt;/mx:HBox&gt;</span>
        <span class="MXMLComponent_Tag">&lt;ns1:MecGrid</span><span class="MXMLDefault_Text"> id=&quot;</span><span class="MXMLString">mgrid</span><span class="MXMLDefault_Text">&quot; width=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot; height=&quot;</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">&quot;</span><span class="MXMLComponent_Tag">/&gt;</span>
    <span class="MXMLComponent_Tag">&lt;/mx:VBox&gt;</span>
<span class="MXMLComponent_Tag">&lt;/mx:Canvas&gt;</span></pre></body>
</html>
